Page({
  data: {},
  onLoad() {
    let yunSdk = getApp().getYouZanYunSdk();
    yunSdk.request({
      isv: 'test.isv-dev.youzan.com',
      path: '/demo',
      method: 'GET',
      succeed: (res) => {
        console.log('res', res);
      },
      failed: (err) => {
        console.log('err', err);
      }
    })
  },
  toPage: function (e) {

    wx.request({
      url: getApp().globalData.apiBaseUrl + 'baby/findPage',
      data: {
        userId: 1
      },
      method: 'post',
      success: (res) => {
        if (res.data.code == 200) {
          if (res.data.data.count > 0) {
            wx.navigateTo({
              url: '/pages/index/index',
            })
          } else {
            wx.navigateTo({
              url: '/pages/add/index',
            })
          }
        }
      }
    })
  },
});